<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>极简双向绑定</title>
	</head>
	<body>
		<div>
			<input type="text" name="" id="inputid" value="" />
			<span id='spanid'></span>
		</div>
	</body>
</html>
<script>
	var obj={};
	Object.defineProperty(obj,'demoObj',{
		set:function(newVal){
			document.getElementById('inputid').value=newVal;
			document.getElementById('spanid').innerHTML=newVal;
			
		}
		
	})
	document.addEventListener('keyup',function(e){
		obj.demoObj =e.target.value;
	})
</script>